const { reactive, createApp, onMounted } = Vue;
const vue_app = {
    setup() {
        const v_data = reactive({
            post_data: {
                id: 0
            },
            ext_data: {
                company_list:[]
            },
            result: {
            },
        });
        onMounted(async () => {
            await methods.initPage();
            await methods.loadData();
            await methods.dealData();
        });

        const methods = {

            //业务函数
            initPage: async () => {
                v_data.post_data.id = GetQueryString("id");
                //console.log("id", v_data.post_data.id);

              
            },
            loadData: async () => {
                const url = ApiHost + "/[subFolder]/[tblName]view";
                const result = await post(url, v_data.post_data);
                if (result.statecode == 0) {
                    v_data.result = result.data;
                } else {
                    layerMsg("应用错误：" + result.message);
                }
            },
            dealData: () => {

            },
            formSubmit: async () => {
                var url = ApiHost + "/[subFolder]/[tblName]edit";
                var post_data = $('#formedit').serialize();
                const result = await post(url, post_data);
                var code = result.statecode;
                if (code == 0) {
                    layerAlert("提交成功");
                } else if (code == 1001) {
                    layerMsg("验证失败：" + result.message);
                } else {
                    layerAlert("提交失败：" + result.message);
                }
            },
        };

        return { d: v_data, ...methods };

    }
};

VM = createApp(vue_app).mount('#app');
